﻿using System;

namespace HslCommunication.Profinet.Melsec
{
	/// <summary>
	/// 三菱PLC的数据类型，此处包含了几个常用的类型
	/// </summary>
	// Token: 0x02000064 RID: 100
	public class MelsecA1EDataType
	{
		/// <summary>
		/// 如果您清楚类型代号，可以根据值进行扩展
		/// </summary>
		/// <param name="code">数据类型的代号</param>
		/// <param name="type">0或1，默认为0</param>
		/// <param name="asciiCode">ASCII格式的类型信息</param>
		/// <param name="fromBase">指示地址的多少进制的，10或是16</param>
		// Token: 0x06000830 RID: 2096 RVA: 0x0002C628 File Offset: 0x0002A828
		public MelsecA1EDataType(byte[] code, byte type, string asciiCode, int fromBase)
		{
			this.DataCode = code;
			this.AsciiCode = asciiCode;
			this.FromBase = fromBase;
			bool flag = type < 2;
			if (flag)
			{
				this.DataType = type;
			}
		}

		/// <summary>
		/// 类型的代号值（软元件代码，用于区分软元件类型，如：D，R）
		/// </summary>
		// Token: 0x17000179 RID: 377
		// (get) Token: 0x06000831 RID: 2097 RVA: 0x0002C679 File Offset: 0x0002A879
		// (set) Token: 0x06000832 RID: 2098 RVA: 0x0002C681 File Offset: 0x0002A881
		public byte[] DataCode { get; private set; } = new byte[2];

		/// <summary>
		/// 数据的类型，0代表按字，1代表按位
		/// </summary>
		// Token: 0x1700017A RID: 378
		// (get) Token: 0x06000833 RID: 2099 RVA: 0x0002C68A File Offset: 0x0002A88A
		// (set) Token: 0x06000834 RID: 2100 RVA: 0x0002C692 File Offset: 0x0002A892
		public byte DataType { get; private set; } = 0;

		/// <summary>
		/// 当以ASCII格式通讯时的类型描述
		/// </summary>
		// Token: 0x1700017B RID: 379
		// (get) Token: 0x06000835 RID: 2101 RVA: 0x0002C69B File Offset: 0x0002A89B
		// (set) Token: 0x06000836 RID: 2102 RVA: 0x0002C6A3 File Offset: 0x0002A8A3
		public string AsciiCode { get; private set; }

		/// <summary>
		/// 指示地址是10进制，还是16进制的
		/// </summary>
		// Token: 0x1700017C RID: 380
		// (get) Token: 0x06000837 RID: 2103 RVA: 0x0002C6AC File Offset: 0x0002A8AC
		// (set) Token: 0x06000838 RID: 2104 RVA: 0x0002C6B4 File Offset: 0x0002A8B4
		public int FromBase { get; private set; }

		/// <summary>
		/// X输入寄存器
		/// </summary>
		// Token: 0x0400020D RID: 525
		public static readonly MelsecA1EDataType X = new MelsecA1EDataType(new byte[]
		{
			88,
			32
		}, 1, "X*", 16);

		/// <summary>
		/// Y输出寄存器
		/// </summary>
		// Token: 0x0400020E RID: 526
		public static readonly MelsecA1EDataType Y = new MelsecA1EDataType(new byte[]
		{
			89,
			32
		}, 1, "Y*", 16);

		/// <summary>
		/// M中间寄存器
		/// </summary>
		// Token: 0x0400020F RID: 527
		public static readonly MelsecA1EDataType M = new MelsecA1EDataType(new byte[]
		{
			77,
			32
		}, 1, "M*", 10);

		/// <summary>
		/// S状态寄存器
		/// </summary>
		// Token: 0x04000210 RID: 528
		public static readonly MelsecA1EDataType S = new MelsecA1EDataType(new byte[]
		{
			83,
			32
		}, 1, "S*", 10);

		/// <summary>
		/// F报警器
		/// </summary>
		// Token: 0x04000211 RID: 529
		public static readonly MelsecA1EDataType F = new MelsecA1EDataType(new byte[]
		{
			70,
			32
		}, 1, "F*", 10);

		/// <summary>
		/// B连接继电器
		/// </summary>
		// Token: 0x04000212 RID: 530
		public static readonly MelsecA1EDataType B = new MelsecA1EDataType(new byte[]
		{
			66,
			32
		}, 1, "B*", 16);

		/// <summary>
		/// TS定时器触点
		/// </summary>
		// Token: 0x04000213 RID: 531
		public static readonly MelsecA1EDataType TS = new MelsecA1EDataType(new byte[]
		{
			84,
			83
		}, 1, "TS", 10);

		/// <summary>
		/// TC定时器线圈
		/// </summary>
		// Token: 0x04000214 RID: 532
		public static readonly MelsecA1EDataType TC = new MelsecA1EDataType(new byte[]
		{
			84,
			67
		}, 1, "TC", 10);

		/// <summary>
		/// TN定时器当前值
		/// </summary>
		// Token: 0x04000215 RID: 533
		public static readonly MelsecA1EDataType TN = new MelsecA1EDataType(new byte[]
		{
			84,
			78
		}, 0, "TN", 10);

		/// <summary>
		/// CS计数器触点
		/// </summary>
		// Token: 0x04000216 RID: 534
		public static readonly MelsecA1EDataType CS = new MelsecA1EDataType(new byte[]
		{
			67,
			83
		}, 1, "CS", 10);

		/// <summary>
		/// CC计数器线圈
		/// </summary>
		// Token: 0x04000217 RID: 535
		public static readonly MelsecA1EDataType CC = new MelsecA1EDataType(new byte[]
		{
			67,
			67
		}, 1, "CC", 10);

		/// <summary>
		/// CN计数器当前值
		/// </summary>
		// Token: 0x04000218 RID: 536
		public static readonly MelsecA1EDataType CN = new MelsecA1EDataType(new byte[]
		{
			67,
			78
		}, 0, "CN", 10);

		/// <summary>
		/// D数据寄存器
		/// </summary>
		// Token: 0x04000219 RID: 537
		public static readonly MelsecA1EDataType D = new MelsecA1EDataType(new byte[]
		{
			68,
			32
		}, 0, "D*", 10);

		/// <summary>
		/// W链接寄存器
		/// </summary>
		// Token: 0x0400021A RID: 538
		public static readonly MelsecA1EDataType W = new MelsecA1EDataType(new byte[]
		{
			87,
			32
		}, 0, "W*", 16);

		/// <summary>
		/// R文件寄存器
		/// </summary>
		// Token: 0x0400021B RID: 539
		public static readonly MelsecA1EDataType R = new MelsecA1EDataType(new byte[]
		{
			82,
			32
		}, 0, "R*", 10);
	}
}
